﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DLL;

namespace BLL
{
    public class OutProductService
    {
        public OutProductRepo m_OutProductRepo;
        public OutProductService()
        {
            m_OutProductRepo = new OutProductRepo();
        }

        #region Paper
        public List<pOutProdPaper_Get_Result> GetOutProdPaper(DateTime? fromDate = null, DateTime? toDate = null)
        {
            return m_OutProductRepo.GetOutProdPaper(fromDate, toDate);
        }

        public void AddOutPaper(OutProdPaper paper)
        {
            m_OutProductRepo.AddOutPaper(paper);
        }

        public void UpdateOutPaper(OutProdPaper paper)
        {
            m_OutProductRepo.UpdateOutPaper(paper);
        }

        public void DeleteOutProdPaper(int id)
        {
           m_OutProductRepo.DeleteOutProdPaper(id);
        }

        public OutProdPaper GetOutProdPaperById(int id)
        {
            return m_OutProductRepo.GetOutProdPaperById(id);
        }

        public int UpdateReferId(int outProdPaperId, int outProdDetailId, int inProdPaperId, int inProdDetaiId)
        {
            return m_OutProductRepo.UpdateReferId(outProdPaperId, outProdDetailId, inProdPaperId, inProdDetaiId);
        }
        #endregion Paper

        #region Detail
        public pOutProdDetail_Add_Result AddOutProdDetail(int amount, int productId, int outProdPaperId = 0, DateTime? date = null, int addBy = 0, int? toShopId = null)
        {
            return m_OutProductRepo.AddOutProdDetail(amount, productId, outProdPaperId, date, addBy, toShopId);
        }

        public int UpdateOutProdDetail(int id, int amount)
        {
            return m_OutProductRepo.UpdateOutProdDetail(id, amount);
        }

        public void DeleteOutProdDetail(int detailId)
        {
            m_OutProductRepo.DeleteOutProdDetail(detailId);
        }

        public List<pOutProdDetail_Get_Result> GetOutProdDetails(int paperId)
        {
            return m_OutProductRepo.GetOutProdDetails(paperId);
        }

        public OutProdDetail GetOutProdDetailById(int id)
        {
            return m_OutProductRepo.GetOutProdDetailById(id);
        }

        public List<pOutProdHistory_Get_Result> GetOutProductHistory(int productId, DateTime? fromDate = null, DateTime? toDate = null)
        {
            return m_OutProductRepo.GetOutProductHistory(productId, fromDate, toDate);
        }
        #endregion Detail
    }
}
